(function (lib, config) {
    var loadFunc = function () {
        var textAry = config.words.split('|'), bgcolorAry = config.bgcolor.split('|'), textcolorAry = config.textcolor.split('|'), imglinkAry = config.imglink.split('|'), weblinkAry = config.weblink.split('|'), identifier = config.identifier.split('|');
        identifier[0] = identifier[0] || 'piaofu-tan';
        textAry[0] = textAry[0] || '女性健康咨询中心';
        textAry[1] = textAry[1] || '非营利性医院 廊坊女性健康关爱中心';
        textAry[2] = textAry[2] || '专家预诊中已加密，请放心交流';
        textAry[3] = textAry[3] || '您好，我是东大妇科主任郭加明，您是想咨询';
        textAry[4] = textAry[4] || '妇科疾病';
        textAry[5] = textAry[5] || '的问题吗？';
        textAry[6] = textAry[6] || '我现在正好有空，简单说说您的情况？我好给您一些建议。';
        imglinkAry[0] = imglinkAry[0] || 'http://fkmb.dongdayy.com/js/20180528swtpic/new_03.png';
        imglinkAry[1] = imglinkAry[1] || 'http://fkmb.dongdayy.com/js/20180528swtpic/banner1.png';
        imglinkAry[2] = imglinkAry[2] || 'http://fkmb.dongdayy.com/js/20180528swtpic/new_qpswt2.png';
        imglinkAry[3] = imglinkAry[3] || 'http://fkmb.dongdayy.com/js/20180528swtpic/new_qpswt3.gif';
        bgcolorAry[0] = bgcolorAry[0] || '#b250a8';
        bgcolorAry[1] = bgcolorAry[1] || '#b250a8';
        bgcolorAry[2] = bgcolorAry[2] || '#f0eff4';
        bgcolorAry[3] = bgcolorAry[3] || '#fff';
        textcolorAry[0] = textcolorAry[0] || '#ffde01';
        textcolorAry[1] = textcolorAry[1] || '#333';
        textcolorAry[2] = textcolorAry[2] || '#010101';
        textcolorAry[3] = textcolorAry[3] || '#565656';
        textcolorAry[4] = textcolorAry[4] || '#565656';
        textcolorAry[5] = textcolorAry[5] || '#565656';
        textcolorAry[6] = textcolorAry[6] || '#cc0000';
        /*TODO 方法*/

        function getscrollTop() {
            var scrollTop = 0;
            if (document.documentElement && document.documentElement.scrollTop) {
                return document.documentElement.scrollTop;
            }
            if (document.body.scrollTop) {
                return document.body.scrollTop;
            }

        }
        function getClientHeight() {
            var clientHeight = 0;
            if (document.body.clientHeight && document.documentElement.clientHeight) {
                var clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            else {
                var clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            return clientHeight;
        }

        var _ua = navigator.userAgent, _ua_text = false, _position = "fixed";
        if (_ua.indexOf('baiduboxapp') > -1) {
            _ua_text = true; _position = "absolute";
        }
        var strVar = [];
        strVar.push("<style>");
        strVar.push("@-webkit-keyframes marquee {");
        strVar.push("    0% { left: 0; }");
        strVar.push("    100% { left: -100%; }");
        strVar.push("}");
        strVar.push("@-moz-keyframes marquee {");
        strVar.push("    0% { left: 0; }");
        strVar.push("    100% { left: -100%; }");
        strVar.push("}");
        strVar.push("@-ms-keyframes marquee {");
        strVar.push("    0% { left: 0; }");
        strVar.push("    100% { left: -100%; }");
        strVar.push("}");
        strVar.push("@-o-keyframes marquee {");
        strVar.push("    0% { left: 0; }");
        strVar.push("    100% { left: -100%; }");
        strVar.push("}");
        strVar.push("@keyframes marquee {");
        strVar.push("  0%{left:0}");
        strVar.push("  100%{left: -100%}");
        strVar.push("}");
        strVar.push("#LRdiv0,#LRdiv1,#LRdiv2{display:none!important;}.flagBox{position:fixed;z-index:3000000000;top:0;left:0;right:0;width:100%;height:100%;-webkit-transition:all 8s ease;-o-transition:all 8s ease;transition:all 8s ease;overflow-y: auto; visibility:hidden;}");
        strVar.push(".swt_fcenter{ width:100%;max-width: 640px; margin:0 auto; background:#f0eff4;overflow: auto;position:fixed; right:0; left:0; top:0; bottom:0;  }");
        strVar.push(".swtqp_div1{ width:100%; margin:0 auto;background:" + bgcolorAry[0] + "; padding:10px 3%; font-size:26px; color:#fff; text-align:center;position: fixed;max-width: 640px;  z-index:99999;font-weight: bold;line-height: 40px;box-sizing: border-box;height: 82px; border-bottom: 1px #c862be solid;}");
        strVar.push(".swtqp_div1 a{font-size:20px;color:#fff; width:15%; float:left; margin-top:1%;line-height: 33px;}");
        strVar.push(".swtqp_div1 img{display: inline-block; margin: 0 auto; width:54.68%; max-height:62px;}");
        strVar.push(".swtqp_div1 a:nth-child(3){ width:16%; float:right;}");
        strVar.push(".swtqp_div2{ width:100%; height:auto; overflow:hidden; padding:5% 0; text-align:center;background: #fff;}");
        strVar.push(".swtqp_div2 img:nth-child(2){ margin-top:6%;}");
        strVar.push(".swtqp_div2 img{ width:78.44%; display:block; margin:0 auto;}");
        strVar.push(".swtqp_div3s{ width: 100%; height: auto;overflow:hidden; margin-top:82px; background:" + bgcolorAry[1] + ";padding: 2% 0 4%; box-sizing: border-box;}");
        strVar.push(".swtqp_div3s h3{  text-align:center; font-size:32px; font-weight:bold;color:" + textcolorAry[0] + "; margin: 0; line-height: 50px;}");
        strVar.push(".swtqp_div3s p{ text-align:center; font-size:24px; color: " + textcolorAry[1] + "; background:" + bgcolorAry[3] + ";width: 65%;display: block;margin: 0 auto;line-height: 35px; }");
        strVar.push(".swtqp_div3{ width:100%; height:auto; overflow:hidden;padding: 5% 4% 17%;box-sizing: border-box;background: " + bgcolorAry[2] + ";position: relative;}");
        strVar.push(".swtqp_div3 a{ width:100%; float:left;margin: 2%;}");
        strVar.push(".swtqp_div3 a b{ color:" + textcolorAry[4] + "; font-weight:normal;}");
        strVar.push(".swtqp_div3 a img{ float:left; margin-right:4%;}");
        strVar.push(".swtqp_div3 p{ box-sizing: border-box;width:82%; float:left; line-height:40px; font-size:24px; color:" + textcolorAry[3] + "; position:relative; padding: 2% 3% 3% 3%;border-radius: 10px; border:1px solid #fff; background:#fff;margin: 0; }");
        strVar.push(".swtqp_div3 p:before{ content:\'\'; width:17px; height:29px;left:-3.5%; top:20%; background:url(http://fkmb.dongdayy.com/js/20180528swtpic/swt_qpsj.png) no-repeat; position: absolute; background-size:100%;}");
        strVar.push(".swtqp_div3 h3{ box-sizing: border-box;text-align:center;font-weight:normal;line-height:29px; font-size:22px; color:" + textcolorAry[2] + "; margin-top: 0; }");
        strVar.push(".swtqp_div3 h3:before{ content:\'\'; width:20px; height:29px;background:url(http://fkmb.dongdayy.com/js/20180528swtpic/new_04.png) no-repeat;background-size:100%; display:inline-block;vertical-align:middle;margin-right:8px;}");

        strVar.push(".swtqp_div3 a:nth-child(3){ margin-top:3%;}");
        strVar.push(".swtqp_div4{ max-width: 640px; width:100%;height:auto; overflow:hidden; margin:2% auto 0%; position: " + _position + ";bottom: 0;padding: 2% 0;background: #fff;}");
        strVar.push(".swtqp_div4 a{width: 100%;text-align: center;display: block;}");
        strVar.push(".swtqp_div4 a img{width: 100%;display: block;}");
        strVar.push("@media screen and (max-width:638px) and (min-width:480px){");
        strVar.push(".swtqp_div1 a{ font-size:16px;}");
        strVar.push(".swtqp_div1 a i{ width:29px; height:33px; margin-right: 3%;}");
        strVar.push(".swtqp_div1{ font-size:21px; padding: 2.5% 3%;line-height: 35px;height:71px;}");
        strVar.push(".swtqp_div3s {margin-top:71px;}");
        strVar.push(".swtqp_div3s h3{  font-size:27px;  line-height: 47px;}");
        strVar.push(".swtqp_div3s p{  font-size:21px; width: 78%;line-height: 28px; }");
        strVar.push(".swtqp_div3 p:before{left: -4.5%;}");
        strVar.push(".swtqp_div3 p{ font-size:18px; line-height:33px;}");
        strVar.push(".swtqp_div3 a img{ width:14%;}");
        strVar.push("}");
        strVar.push("@media screen and (max-width: 479px) and (min-width: 319px){");
        strVar.push(".swtqp_div1{ font-size:17px;line-height: 29px;height: 53px;}");
        strVar.push(".swtqp_div1 a{width: 19%; font-size:14px;line-height: 24px;}");
        strVar.push(".swtqp_div1 a i{ width:25px; height:28px;}");
        strVar.push(".swtqp_div3s {font-size: 16px; margin-top:53px;}");
        strVar.push(".swtqp_div3s h3{  font-size:20px;  line-height: 35px;}");
        strVar.push(".swtqp_div3s p{  font-size:15px; width: 83%;line-height: 28px; }");
        strVar.push(".swtqp_div3 a img{ width:14%;}");
        strVar.push(".swtqp_div3 p,.swtqp_div3 a:nth-child(2) p{ font-size:12px; line-height:21px; }");
        strVar.push(".swtqp_div3 p:before{ width:10px; height:15px; left: -4.0%;}");
        strVar.push(".swtqp_div3 h3{line-height:22px; font-size:18px;  }");
        strVar.push(".swtqp_div3 h3:before{ width:16px; height:22px;margin-right:8px;}");

        strVar.push("}");
        strVar.push("@media screen and (max-width:414px) and (min-width:380px){");
        strVar.push(".swtqp_div3 p, .swtqp_div3 a:nth-child(2) p{ font-size:15px; line-height:30px;}");
        strVar.push(".swtqp_div3 p:before{width: 12px;height: 18px; }");
        strVar.push(".swtqp_div1 a{ width: 17%;font-size: 16px;}");
        strVar.push(".swtqp_div1 a:nth-child(2){ width:7%;}");
        strVar.push("}");
        strVar.push("@media screen and (max-width:380px) and (min-width:360px){");
        strVar.push(".swtqp_div3 p, .swtqp_div3 a:nth-child(2) p{font-size:13px; line-height:25px;}");
        strVar.push(".swtqp_div3 p:before{width: 12px;height: 18px; }");
        strVar.push(".swtqp_div1 a{width: 17.5%;font-size: 15px;}");
        strVar.push(".swtqp_div1 a:nth-child(2){ width:7%;}");
        strVar.push("}");
        strVar.push("</style>");
        strVar.push("<div class=\'flagBox\' id=\'flagBox\'>");
        strVar.push("  <div class=\'swt_fcenter\' id=\'swt_fcenter\'>");
        strVar.push("    <div class=\'swtqp_div1\'> <a onclick=\'swt_center_nswt();\' id=\'aclose\'><返回</a> <img src=\'" + imglinkAry[0] + "\' > <a onclick=\'swt_center_nswt();\'>关闭</a> </div>");
        strVar.push("    <div class=\'swtqp_div3s\'>");
        strVar.push("            <h3>" + textAry[0] + "</h3>");
        strVar.push("            <p>" + textAry[1] + "</p>");
        strVar.push(" </div>");
        strVar.push("    <div class=\'swtqp_div2\' onClick=\'openZoosUrl(\"" + identifier[0] + "\")\'><a href=\'javascript:void(0);\' onClick=\'openZoosUrl(\"" + identifier[0] + "\")\'>  <img src=\'" + imglinkAry[1] + "\'> </a></div>");
        strVar.push("");
        strVar.push("    <div class=\'swtqp_div3\' id=\'swtqp_div3\' ><h3>" + textAry[2] + "</h3> <a href=\'javascript:void(0);\' onclick=\'openZoosUrl(\"" + identifier[0] + "\")\' id=\'hycq_dhk01\' style=\'display:none;\'> <img src=\'" + imglinkAry[2] + "\' class=\'swtpb_t\'>");
        strVar.push("      <p>" + textAry[3] + "<b id=\'rl_dhlist1\'>"+textAry[4]+"</b><span style='color:"+textcolorAry[5]+";'>" + textAry[5] + "</span></p>");
        strVar.push("      </a> <a href=\'javascript:void(0);\' onclick=\'openZoosUrl(\"" + identifier[0] + "\")\' id=\'hycq_dhk02\' style=\'display:none;\'><img src=\'" + imglinkAry[2] + "\' class=\'swtpb_t\'>");
        strVar.push("      <p style='color:"+textcolorAry[6]+";'>" + textAry[6] + "</p>");
        strVar.push("      </a> </div>");
        strVar.push("       <div class=\'swtqp_div4\' id=\'swtqp_div4\' style=\'bottom:0%;\'> <a href=\'javascript:void(0);\' onClick=\'openZoosUrl(\"" + identifier[0] + "\")\'> <img src=\'" + imglinkAry[3] + "\' class=\'swtpb_t\'></a>");
        strVar.push("      </div>");
        strVar.push("</div>");
        strVar.push("</div>");
        strVar.push("");
        var o = document.createElement('div');
        o.innerHTML = strVar.join('');
        while (o.firstElementChild) {
            document.body.appendChild(o.firstElementChild);
        };

        function addEvent(obj, type, fn) {
            if (obj.attachEvent) {
                obj.attachEvent('on' + type, function () {
                    fn.call(obj);
                })
            } else {
                obj.addEventListener(type, fn, false);
            }
        }


        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
            window.setTimeout(showDiv, config.firsttime * 1000);
        }
        var _scrollset = 0;
        function showDiv() {
            document.getElementById('flagBox').style.visibility = 'visible';
            document.getElementById('flagBox').style.display = 'block';
            var hycq_dhk01 = document.getElementById("hycq_dhk01");
            var hycq_dhk02 = document.getElementById("hycq_dhk02");
            setTimeout(stoolshow, 0);
            function stoolshow() { setTimeout(stoolshow2, 0); }
            function stoolshow2() { hycq_dhk01.style.display = "block"; setTimeout(stoolshow3, 3000); }
            function stoolshow3() { hycq_dhk02.style.display = "block"; }
            history.pushState({ lzjt: 1 }, "", "#com");
            _scrollset = 1;
        }

        swt_center_nswt = function () {
            document.getElementById('flagBox').style.display = 'none';
            document.getElementById('flagBox').style.visibility = 'hidden';
            _scrollset = 0;
            window.setTimeout(showDiv, config.relapsetime * 1000);
            history.replaceState(null, '', location.pathname + location.search);

        }

        window.addEventListener('hashchange', function () {
            swt_center_nswt();
        });





        // 调用方法
        (function () {
            var r = document.referrer, swtqp_div3 = document.querySelector('.swtqp_div3').getElementsByTagName('a')[0].getElementsByTagName('p')[0];
            var _ds = document.querySelector('.swtqp_div3').getElementsByTagName('a'), d1 = _ds[0], d2 = _ds[1];
            setTimeout(function () {
                d1.style.visibility = 'visible';
                setTimeout(function () {
                    window.scroll(0, d2.offsetHeight);
                    d2.style.visibility = 'visible';
                }, 2000)
            }, 1000);

            var keyfun = function (a) {
                if (a == "" || a == null) { return ""; }
                var refer = a;
                var sosuo = refer.split(".")[1];
                var grep = null;
                var str = null;
                var keyword = null;
                switch (sosuo) {
                    case "baidu":
                        refer += '&';
                        grep = /word\=.*\&/i;
                        str = refer.match(grep);
                        if (str != null) {
                            keyword = str.toString().split("=")[1].split("&")[0];
                            return decodeURIComponent(keyword);
                        }
                        break;
                    case "sogou":
                        grep = /keyword\=.*\&/i;
                        str = refer.match(grep);
                        if (str != null) {
                            keyword = str.toString().split("=")[1].split("&")[0];
                            return decodeURIComponent(keyword);
                        }
                        break;
                    case "sm":
                    case "m":
                        if (refer.indexOf('sm') > -1) {
                            refer = refer.replace('?q=', '?&q=');
                            grep = /&q\=.*\&/i;
                            str = refer.match(grep);
                            if (str != null) {
                                keyword = str.toString().split("&")[1].split("=")[1];
                                return decodeURIComponent(keyword);
                            }
                        }
                        break;
                }
                return '';
            }
            var key_title_text = keyfun(r), key_fk_tjfs = '';

            if (swtqp_div3 != null) {
                if (key_title_text != '') {
                    swtqp_div3.innerHTML = '"+textAry[3]+"【<b style="color: #bb1a1a;font-weight: bolder;">' + key_title_text + '</b>】"+textAry[4]+"';
                    key_fk_tjfs = encodeURIComponent('||key:' + key_title_text);
                }
            }

        })();

        if (_ua_text) {
            var _t_swtqp_div4 = document.getElementById('swtqp_div4').style.bottom;
            if (_t_swtqp_div4 == '') { _t_swtqp_div4 = 0; }
            addEvent(window, 'scroll', function () {
                document.getElementById('swtqp_div4').style.bottom = parseInt(_t_swtqp_div4) - (getScrollTop() / getClientHeight()) * 100 + '%';

            })

        }

        /***对话框抖动***/
        mfx = function (isWin) {
            var t = 7, z = 3, del = function () { clearInterval(mfx.ID); return mfx };
            del().ID = setInterval(function () {
                var i = t / 180 * Math.PI, x = Math.sin(i) * z, y = Math.cos(i) * z, s = swtqp_div3.style;
                isWin ? window.moveBy(x, y) : (s.top = x + 'px', s.left = y + 'px');
                if ((t += 90) > 1080) del();
            }, 30);
        }
        window.setInterval("mfx()", 6000);
    };
    lib.load(loadFunc);/*执行代码*/
})('{{lib}}', '{{config}}');